<template>
  <div class="c-pt16 c-bg-sgray">
    <section class="c-bg-white c-ph24 c-fs24">
      <div class="c-hh100 c-bd-b1-f5 c-flex-row c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fw-b">老师头像</span>
        <img class="c-ww60 c-hh60 c-brp50" :src="teacherInfo.headimg" alt="" />
      </div>
      <div class="c-hh100 c-bd-b1-f5 c-flex-row c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fw-b">咨询老师</span>
        <span class="c-maxw440 c-text-ellipsis1">{{teacherInfo.name}}</span>
      </div>
      <div class="c-hh100 c-bd-b1-f5 c-flex-row c-aligni-center">
        <span class="c-flex-grow1 c-w0 c-fw-b">咨询时间</span>
        <span>{{teacherInfo.date}}</span>
      </div>
    </section>
    <wxOpenWeapp :path="wxappPath" :pathQuety="wxappQuery">
      <div class="c-mt32 c-mh24 c-hh72 c-br36 theme-bg c-fc-white c-fs28 c-fw-b c-flex-row c-flex-center">申请加入</div>
    </wxOpenWeapp>
  </div>
</template>

<script>
import wxOpenWeapp from '@/components/templates/common/wxOpenWeapp.vue';
import { utilJs } from "@/utils/common.js"
export default {
  name: "InviteBook",
  components:{
    wxOpenWeapp
  },
  data() {
    return {
      teacherInfo: {},
      wxappQuery:'',
      wxappPath:'yuyue/pages/scanCodeStu/index',
    }
  },
  created() {
    utilJs.appShare(this);
  },
  mounted() {
    setDocumentTitle("邀请进入视频会议");
    this.liveId = this.$route.query.liveId
    console.log(process.env)
    this.getTeacherInfo();

  },
  methods: {
    //   获取师资信息
    getTeacherInfo() {
       utilJs.getMethod(`${global.apiurl}live/appointmentLive/getAppointmentLive?liveId=${this.liveId}`, res => {
        this.teacherInfo = res;
        const ENV = process.env.VUE_APP_ENV;
        const ENV_MAP = {
          'dev':1,
          'sit':2,
          'production':3
        }
        this.wxappQuery = `env=${ENV_MAP[ENV]}&liveId=${this.liveId}&fromType=1&userId=${localStorage.getItem("userId")}`;
        this.wechatShare();
       })
    },
       //分享
    wechatShare: function () {
      let title = this.teacherInfo.name;
      let shareImg = this.teacherInfo.headimg;
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?atId=${this.atId}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = '邀请进入视频会议';
      utilJs.wechatConfig(shareUrl, title, shareImg, shareDesc, function () {}, true, {
          isWxOpenLaunchWeap: 1,
        });
    },
    //手机端分享
    appShare: function () {
      let title = this.teacherInfo.name;
      let shareImg = this.teacherInfo.headimg;
      let shareUrl = `${window.location.href.split("#")[0]}#${this.$route.path}?atId=${this.atId}&refereeId=${localStorage.getItem("userId")}`;
      let shareDesc = '邀请进入视频会议';
      utilJs.appShareTrue(title, shareImg, shareUrl, shareDesc);
    },
  },
}
</script>
